﻿using System.Collections.Generic;

namespace Game
{
    public class ConfigSystem : InitSystem<ConfigSystem>
    {
        private List<ConfigEntity> _configEntityList = new List<ConfigEntity>();

        public void Add(ConfigEntity configEntity)
        {
            _configEntityList.Add(configEntity);
        }

        public T Get<T>() where T : ConfigEntity
        {
            for (int i = 0; i < _configEntityList.Count; ++i)
            {
                ConfigEntity configEntity = _configEntityList[i];
                if (configEntity.GetType() == typeof(T))
                {
                    return (T) configEntity;
                }
            }
            return null;
        }
    }
}